package com.homwee.factory;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ProjectIdDialog extends Dialog {

    private TextView tv_project_id;
    private Button bt_ok;
    private DialofClickListener dialofClickListener;
    private String projectId="XXX";

    public ProjectIdDialog(Context context) {
        super(context);

    }

    private void initListener() {
        bt_ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (dialofClickListener!=null){
                    dialofClickListener.infOk();
                    dismiss();
                }
            }
        });
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.project_id_dialog);
        initView();
        initListener();
    }
    public ProjectIdDialog setProjectId(String projectId){
        this.projectId=projectId;
        return this;
    }


    private void initView() {
        tv_project_id = (TextView) findViewById(R.id.tv_project_id);
        bt_ok = (Button) findViewById(R.id.bt_ok);

        tv_project_id.setText(projectId);
    }

    public interface DialofClickListener{
        void infOk();
    }
    public void setDialofClickListener(DialofClickListener dialofClickListener){
        this.dialofClickListener=dialofClickListener;
    }
}